package mybaits;

import annotion.Table;

@Table(tableName = "user")
public class User {
    int id;
    String name;
    int age;
    public User(int id, String name) {
        this.id = id;
        this.name = name;
        this.age = age;
    }
    // 重写 toString 方法
    //类中不重写toString方法，则打印对象时，打印的是对象地址继承的object类中的toString方法
    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
    // 添加无参构造函数
    public User() {
    }


    // getter和setter方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }

}
